//导入 axios
import axios from "axios"
import store from "@/store/index";
//响应拦截器
axios.interceptors.request.use((config) => {
  config.headers["authorization"] = store.state._token;
  return config
});
axios.interceptors.response.use((ret) => {
  let _token = ret.data._token ? ret.data._token : "";
  // 存vuex+localStorage
  store.commit("setToken", _token);
  return ret.data || ret

});

//导出axios
export default axios